

function say() {
    alert("LC:705. 设计哈希集合");
}
say();


/**
 * Initialize your data structure here.
 */
var MyHashSet = function() {
    this.arr = [] // 9:00-9:15
};

/**
 * @param {number} key
 * @return {void}
 */
MyHashSet.prototype.add = function(key) {
    var arr = this.arr
    if(!this.contains(key)){
        arr.push(key)
    }
};

/**
 * @param {number} key
 * @return {void}
 */
MyHashSet.prototype.remove = function(key) {
    var arr = this.arr
    for(var i = 0; i < arr.length; i++){
        if(arr[i] == key){
            arr.splice(i, 1)
        }
    }
};

/**
 * Returns true if this set contains the specified element
 * @param {number} key
 * @return {boolean}
 */
MyHashSet.prototype.contains = function(key) {
    var arr = this.arr
    for(var i = 0; i < arr.length; i++){
        if(key == arr[i]){
            return true
        }
    }
    return false
};

/**
 * Your MyHashSet object will be instantiated and called as such:
 * var obj = new MyHashSet()
 * obj.add(key)
 * obj.remove(key)
 * var param_3 = obj.contains(key)
 */
